<template>
  <div id="receiveRecordSearch">
    <div class="search-box">
      <el-form
        ref="ruleForm"
        :inline="true"
        :model="formInline"
        :rules="rules"
        class="demo-form-inline"
      >
        <el-form-item label="大鹏号" prop="dpAccount">
          <el-input
            v-model="formInline.dpAccount"
            placeholder="请输入大鹏号"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="参与时间段" prop="checkTime">
          <el-date-picker
            v-model="checkTime"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            format="yyyy-MM-dd HH:mm:ss"
            @change="getTime"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button
            type="success"
            icon="el-icon-search"
            @click="toSearch('ruleForm')"
          >
            查询
          </el-button>
          <el-button type="success" plain @click="reset">
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import { sysNormalDisable } from '@utils/dictionariesFunc'

export default {
  props: {
    formInline: {
      type: Object,
      default: function() {
        return {
          dpAccount: '', //大鹏号
          endDate: '', //结束时间
          startDate: '' //开始时间
        }
      }
    }
  },
  data() {
    return {
      rules: {
        dpAccount: [],
        checkTime: []
      },
      checkTime: [],
    }
  },
  mounted() {
  },
  methods: {
    getTime(val) {
      this.formInline.startDate = this.checkTime[0]
      this.formInline.endDate = this.checkTime[1]
    },
    /* 搜索 */
    toSearch(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$emit('toSearch')
        } else {
          return false
        }
      })
    },
    /* 重置 */
    reset() {
      this.$refs['ruleForm'].resetFields()
      this.checkTime = []
      this.formInline.startDate = ''
      this.formInline.endDate = ''
    }
  }
}
</script>

<style lang="less">
</style>
